package com.csx.micrometer.webflux.sample.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author cuisongxu
 * @date 2023/2/16 16:54
 */
@RequestMapping("/webflux/consumer")
@RestController
public class WebFluxSampleConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/testSuccess")
    public String testSuccess() {

        String res = restTemplate.getForObject("http://webflux-sample-producer/webflux/producer/testSuccess", String.class);
        return "hello consumer, res from producer: " + res;
    }
}
